package com.wswy.wzcx.ui.activity.news

import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData
import com.wswy.wzcx.model.news.NewsCategory
import com.wswy.wzcx.module.HomeNewsCategoryLoader
import com.wswy.wzcx.module.base.BaseViewModel
import com.wswy.wzcx.module.base.Resource

class ResultNewsViewModel : BaseViewModel() {

    private val newsCategories = MutableLiveData<Resource<List<NewsCategory>?>>()


    fun loadCategory(){
        HomeNewsCategoryLoader().loader {
            newsCategories.postValue(Resource.success(it.orNull()))
        }
    }

    fun getNewsCategoriesLiveData():LiveData<Resource<List<NewsCategory>?>> = newsCategories

}